import 'city.dart';

class Province {
  String _name;
  List<City> _city;

  Province({String name, List<City> city}) {
    this._name = name;
    this._city = city;
  }

  String get name => _name;
  set name(String name) => _name = name;
  List<City> get city => _city;
  set city(List<City> city) => _city = city;

  Province.fromJson(Map<String, dynamic> json) {
    _name = json['name'];
    if (json['city'] != null) {
      _city = new List<City>();
      json['city'].forEach((v) {
        _city.add(new City.fromJson(v));
      });
    }
  }


  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this._name;
    if (this._city != null) {
      data['city'] = this._city.map((v) => v.toJson()).toList();
    }
    return data;
  }
}